博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
巴巴运动网学习笔记(51-55)
阅读量:4692 次
发布时间:2019-06-09

本文共 8230 字,大约阅读时间需要 27 分钟。

1.完成上传文件的分页显示(显示id,文件路径,上传日期)

a.UploadAction

View Code
1 package cnblogs.xiaoqiu.web.action.upload; 2 import java.util.LinkedHashMap; 3 import javax.annotation.Resource; 4 import javax.servlet.http.HttpServletRequest; 5 import javax.servlet.http.HttpServletResponse; 6 import org.apache.struts.action.Action; 7 import org.apache.struts.action.ActionForm; 8 import org.apache.struts.action.ActionForward; 9 import org.apache.struts.action.ActionMapping;10 import org.springframework.stereotype.Controller;11 import cnblogs.xiaoqiu.bean.PagingBean;12 import cnblogs.xiaoqiu.bean.ScrollResult;13 import cnblogs.xiaoqiu.bean.upload.UploadFile;14 import cnblogs.xiaoqiu.service.upload.UploadService;15 import cnblogs.xiaoqiu.web.action.formbean.UploadForm;16 @Controller("/control/upload/list")17 public class UploadAction extends Action {18     @Resource(name="uploadServiceImpl")19     private UploadService uploadService;20     @Override21     public ActionForward execute(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)22     throws Exception {23         UploadForm uploadForm = (UploadForm)form;24         int pageCounts = 10;25         int currentPage = uploadForm.getCurrentPage();26         int begin = (currentPage-1)*pageCounts;27         LinkedHashMap
orderHashMap = new LinkedHashMap
();28 orderHashMap.put("id", "desc");29 ScrollResult
scrollResult = uploadService.getScrollResult(UploadFile.class, begin, pageCounts, orderHashMap);30 PagingBean
pagingBean = new PagingBean
(currentPage,scrollResult,pageCounts);31 request.setAttribute("pagingBean", pagingBean);32 return mapping.findForward("list");33 }34 35 }

b.uploadfile.jsp

View Code
1 <%@ page contentType="text/html;charset=UTF-8" %> 2 <%@ include file="/WEB-INF/page/share/taglib.jsp" %> 3  4  5 上传文件管理 6 
7
8 32 34 35 36 37
38
39
40
52
41
44
45
46
47
48
49
50
51
53
54
55
56
57
58 59
60
61
71
72
42 <%@ include file="/WEB-INF/page/share/paging.jsp" %>43
代号
文件
上传日期
${uploadFile.id }
${uploadFile.uploadTime }
62
63
66
69
70
64
65
67   68
73
74 75

c.UploadForm

View Code
1 package cnblogs.xiaoqiu.web.action.formbean; 2  3 import org.apache.struts.upload.FormFile; 4  5 public class UploadForm extends BaseForm { 6     private static final long serialVersionUID = 1724297881513682925L; 7      8     private FormFile uploadFile; 9     private int id;10     private int[] deleteIds;11     12     13     public int[] getDeleteIds() {14         return deleteIds;15     }16 17     public void setDeleteIds(int[] deleteIds) {18         this.deleteIds = deleteIds;19     }20 21     public int getId() {22         return id;23     }24 25     public void setId(int id) {26         this.id = id;27     }28 29     public FormFile getUploadFile() {30         return uploadFile;31     }32     33     public void setUploadFile(FormFile uploadFile) {34         this.uploadFile = uploadFile;35     }36     37 }

2.完成文件列表的全选功能(添加复选框,编写javascript函数,formbean中添加ids[])

3.完成上传文件的多选删除功能

View Code
1 public ActionForward delete(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response) 2     throws Exception { 3         UploadForm uploadForm = (UploadForm)form; 4         int[] ids = uploadForm.getDeleteIds(); 5         for(int i=0;i

4.产品管理模块的详细分析与设计

a.产品的相关操作:分页显示,添加,修改,查询,上架/下架
b.产品的相关字段

5.创建产品实体对象

View Code
1 package cnblogs.xiaoqiu.bean.product;  2   3 import java.io.Serializable;  4 import java.util.Date;  5   6 import javax.persistence.Entity;  7 @Entity  8 public class Product implements Serializable{  9     private static final long serialVersionUID = 8608943966862111393L; 10     private String id; 11     private String name; 12     private Brand brand; 13     private ProductType productType; 14     private String model; 15     private float basePrice = 0; 16     private float marketPrice = 0; 17     private float sellPrice = 0; 18     private String description; 19     private String buyExplain; 20     private Date createTime = new Date(); 21     private boolean isVisible = true; 22     private float weight = 0; 23     private boolean isCommend = false; 24     private int clickCount = 0; 25     private int sellCount = 0; 26     private Sex sexRequest = Sex.NONE; 27     public String getId() { 28         return id; 29     } 30     public void setId(String id) { 31         this.id = id; 32     } 33     public String getName() { 34         return name; 35     } 36     public void setName(String name) { 37         this.name = name; 38     } 39     public Brand getBrand() { 40         return brand; 41     } 42     public void setBrand(Brand brand) { 43         this.brand = brand; 44     } 45     public ProductType getProductType() { 46         return productType; 47     } 48     public void setProductType(ProductType productType) { 49         this.productType = productType; 50     } 51     public String getModel() { 52         return model; 53     } 54     public void setModel(String model) { 55         this.model = model; 56     } 57     public float getBasePrice() { 58         return basePrice; 59     } 60     public void setBasePrice(float basePrice) { 61         this.basePrice = basePrice; 62     } 63     public float getMarketPrice() { 64         return marketPrice; 65     } 66     public void setMarketPrice(float marketPrice) { 67         this.marketPrice = marketPrice; 68     } 69     public float getSellPrice() { 70         return sellPrice; 71     } 72     public void setSellPrice(float sellPrice) { 73         this.sellPrice = sellPrice; 74     } 75     public String getDescription() { 76         return description; 77     } 78     public void setDescription(String description) { 79         this.description = description; 80     } 81     public String getBuyExplain() { 82         return buyExplain; 83     } 84     public void setBuyExplain(String buyExplain) { 85         this.buyExplain = buyExplain; 86     } 87     public Date getCreateTime() { 88         return createTime; 89     } 90     public void setCreateTime(Date createTime) { 91         this.createTime = createTime; 92     } 93     public boolean isVisible() { 94         return isVisible; 95     } 96     public void setVisible(boolean isVisible) { 97         this.isVisible = isVisible; 98     } 99     public float getWeight() {100         return weight;101     }102     public void setWeight(float weight) {103         this.weight = weight;104     }105     public boolean isCommend() {106         return isCommend;107     }108     public void setCommend(boolean isCommend) {109         this.isCommend = isCommend;110     }111     public int getClickCount() {112         return clickCount;113     }114     public void setClickCount(int clickCount) {115         this.clickCount = clickCount;116     }117     public int getSellCount() {118         return sellCount;119     }120     public void setSellCount(int sellCount) {121         this.sellCount = sellCount;122     }123     public Sex getSexRequest() {124         return sexRequest;125     }126     public void setSexRequest(Sex sexRequest) {127         this.sexRequest = sexRequest;128     }129     130     131 }
View Code
1 package cnblogs.xiaoqiu.bean.product;2 3 public enum Sex {4     NONE{
public String getName(){
return "男女不限";}},5 MALE{
public String getName(){
return "男";}},6 FEMALE{
public String getName(){
return "女";}};7 public abstract String getName();8 }

 

转载于:https://www.cnblogs.com/xiaoqv/archive/2012/04/12/2444276.html

你可能感兴趣的文章
转 lucene3搜索引擎,索引建立搜索排序分页高亮显示, IKAnalyzer分词
查看>>
bootstrap datetimepicker 位置错误
查看>>
9结构型模式之代理模式
查看>>
第二节 整型数据
查看>>
Python 序列
查看>>
Liferay的架构:缓存(第一部分)
查看>>
初识B/S结构编程技术
查看>>
方法、hadoop源码之JobQueueTaskScheduler-by小雨
查看>>
页面重构总结
查看>>
IO 函数
查看>>
Unity V3 初步使用 —— 为我的.NET项目从简单三层架构转到IOC做准备
查看>>
JSP页面间传递参数
查看>>
VSNETcodePrint 2005 & SQL ServerPrint 2005
查看>>
java数组基本操作
查看>>
String的indexOf()用于获取字符串中某个子字符串的位置
查看>>
shell 脚本运算符
查看>>
又一道软通动力7K月薪面试题——银行业务调度系统
查看>>
Matlab画图-非常具体,非常全面
查看>>
ReactJS入门
查看>>
linux网站配置文件.htaccess伪静态转换到IIS web.config中
查看>>